cmake_minimum_required(VERSION 2.8)
project(dem2rgb)
#set(CMAKE_CXX_STANDARD 17)
file(GLOB_RECURSE srcs RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} main.cpp 3rdParty/*.c)
if(ANDROID OR IOS OR APPLE)
  list(REMOVE_ITEM srcs "3rdParty/jpeg/jmemansi.c")
else()
  list(REMOVE_ITEM srcs "3rdParty/jpeg/jmemnobs.c")
endif()
#message("11:${srcs}")
configure_file(3rdParty/proj/proj_config.h.in proj_config.h @ONLY)
include_directories(
  3rdParty/jpeg
  3rdParty/zlib
  3rdParty/proj
  3rdParty/libtiff
  3rdParty/libgeotiff 3rdParty/libgeotiff/libxtiff
  3rdParty/liblzma 3rdParty/liblzma/api 3rdParty/liblzma/check 3rdParty/liblzma/common 3rdParty/liblzma/common0 3rdParty/liblzma/delta 3rdParty/liblzma/lz 3rdParty/liblzma/lzma 3rdParty/liblzma/rangecoder 3rdParty/liblzma/simple
  ${CMAKE_CURRENT_BINARY_DIR})
add_definitions(/DHAVE_CONFIG_H)
if(UNIX)
  list(REMOVE_ITEM srcs "3rdParty/zlib/minizip/iowin32.c")
  add_definitions(-DMYTHREAD_POSIX)
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/zlib/zconf.h.lnx" "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/zlib/zconf.h")
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libtiff/tif_config.h.lnx" "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libtiff/tif_config.h")
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libtiff/tiffconf.h.lnx" "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libtiff/tiffconf.h")
else()
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/zlib/zconf.h.win" "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/zlib/zconf.h")
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libtiff/tif_config.h.win" "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libtiff/tif_config.h")
  execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libtiff/tiffconf.h.win" "${CMAKE_CURRENT_SOURCE_DIR}/3rdParty/libtiff/tiffconf.h")
endif()
add_executable(${PROJECT_NAME} ${srcs})
if(UNIX)
  target_link_libraries(${PROJECT_NAME} pthread)
endif()
